<?php
class Mprofil extends CI_Model{
	function liat(){
		$liat = $this->db->get('profil_pemandu');
		if($liat->num_rows()>0) {
			foreach ($liat->result()as $data) {
				$hasil[] = $data;
			}
			return $hasil;
		}
	}
	
	function tambah(){
		$nama = $this->input->post('nama');
		$fakultas = $this->input->post('fakultas');
		$jurusan = $this->input->post('jurusan');
		$data = array(
			'nama' => $nama,
			'fakultas' => $fakultas,
			'jurusan' => $jurusan
			);
		$this->db->insert('profil_pemandu',$data);
	}
	
	function update($id){
		$nama = $this->input->post('nama');
		$fakultas = $this->input->post('fakultas');
		$jurusan = $this->input->post('jurusan');
		$status = $this->input->post('0');
		$data = array(
			'nama' => $nama,
			'fakultas' => $fakultas,
			'jurusan' => $jurusan,
			'status' => $status
			);
		$this->db->where('id_pemandu', $id);
		$this->db->update('profil_pemandu',$data);
	}
	
	function hapus($id){
		$this->db->delete('profil_pemandu',array('id_pemandu'=>$id));
	}
	
	function lihat($id){
		return $this->db->get_where('profil_pemandu', array('id_pemandu' => $id))->row();
	}
	
	function oke($id){
		$data = array('status' => 1);
		$this->db->where('id_pemandu', $id);
		$this->db->update('profil_pemandu',$data);
	}
}
?>
